Strict

Import agfx

Global myTmpScreen:TTmpScreen

Class TAgfx_test_app Extends TFramework

	Method OnCreate:Int()
		
		Super.OnCreate()
				
		DISPLAY.SetVirtualSize(480,320)
		myTmpScreen = New TTmpScreen		
		myTmpScreen.Prepare()
		DEBUG = True
		Return 0
	End

End


Class TTmpScreen Extends TScreen
	
	Field myBoids:TBoids

	' START when app is created
	Method Start:Void()
	
		Self.myBoids = New TBoids(50,New TVector2(16,16),New TVector2(320,240))
		
		Self.myBoids.AddRule(New TRule_velocity(0.01))
		Self.myBoids.AddRule(New TRule_aligment(0.1))
		Self.myBoids.AddRule(New TRule_cohesion(0.1))
		Self.myBoids.AddRule(New TRule_RangeBounce(0.1))
		Self.myBoids.AddRule(New TRule_FollowTarget(0.1))
		
		Self.myBoids.GenerateBoids()
	End
	
	' main app logic loop update
	Method Update:Void()
	
		myBoids.target_position.Set(MOUSE.x,MOUSE.y)
	
		Self.myBoids.Update()
	End
	
	' main app render loop
	Method Render:Void()
		Cls
		Self.myBoids.Render()
	End
End
